#
# 'Login page' objects description module

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class LoginPage: 
        
    def user_name_filed(driver):
        driver.find_element_by_name("q")
    
    def password_field(driver):
        driver.find_element_by_name("b")
    
    def login_button(driver):
        driver.find_element_by_name("w")
        
        
class UserLogin(BaseTestCase):
    def __init__(self, context):
        self.tc = context  # make username, web driver, etc. available to the page object's methods

    def login_valid(self, uname=None):
        elem = self.tc.driver.find_element_by_id('user_id')
        elem.send_keys(uname)
        elem.submit()        
